home *** CD-ROM | disk | FTP | other *** search
-
- function havePreviewTarget()
- {
- var bHavePreviewTarget = false;
-
- if (dw.getFocus() == 'site')
- bHavePreviewTarget = site.getSelection().length > 0;
- else if (dw.getFocus() == 'document')
- bHavePreviewTarget = dw.getDocumentDOM('document') != null;
-
- return bHavePreviewTarget;
- }
-
- function receiveArguments()
- {
- var whichBrowser = arguments[0];
- var theBrowser = null;
- var i=0;
- var browserList = null;
- var result = false;
-
- if (havePreviewTarget())
- {
- // Code to check if we were called from a shortcut key
- if (whichBrowser == 'primary' || whichBrowser == 'secondary')
- {
- // get the path of the selected browser
- if (whichBrowser == 'primary')
- {
- theBrowser = dw.getPrimaryBrowser();
- }
- else if (whichBrowser == 'secondary')
- {
- theBrowser = dw.getSecondaryBrowser();
- }
-
- // match up the path with the name of the corresponding browser
- // that appears in the menu
- browserList = dw.getBrowserList();
- while (i < browserList.length)
- {
- if (browserList[i+1] == theBrowser)
- theBrowser = browserList[i];
- i+=2;
- }
- }
- else
- theBrowser = whichBrowser;
-
- // Only launch the browser if we have a valid browser selected
- if (theBrowser != "file:///" && typeof(theBrowser) != "undefined" && theBrowser.length > 0)
- {
- if (dw.getFocus() == 'site')
- dw.browseDocument(site.getSelection(),theBrowser);
- else
- dw.browseDocument(dw.getDocumentPath('document'),theBrowser);
- }
- else
- {
- // otherwise, if the user hit the F12 or Ctrl+F12 keys,
- // ask if they want to specify a primary or secondary browser now.
- if (whichBrowser == 'primary')
- {
- result = window.confirm(MSG_NoPrimaryBrowserDefined);
- }
- else if (whichBrowser == 'secondary')
- {
- result = window.confirm(MSG_NoSecondaryBrowserDefined);
- }
-
- // If they clicked OK, show the prefs dialog with the browser panel
- if (result)
- dw.showPreferencesDialog('browsers');
- }
- }
- }
-
- function canAcceptCommand()
- {
- var PIB = dw.getBrowserList();
-
- if (arguments[0] == 'primary' || arguments[0] == 'secondary')
- return havePreviewTarget();
-
- return havePreviewTarget() && (PIB.length > 0);
- }
-
- // getDynamicContent returns the contents of a dynamically generated menu.
- // returns an array of strings to be placed in the menu, with a unique
- // identifier for each item separated from the menu string by a semicolon.
- //
- // return null from this routine to indicate that you are not adding any
- // items to the menu
- function getDynamicContent(itemID)
- {
- var browsers = null;
- var PIB = null;
- var i;
- var j=0;
- browsers = new Array();
- PIB = dw.getBrowserList();
- // each browser pair has the name of the browser and the path that leads
- // to the application on disk. We only put the names in the menus
- for (i=0; i<PIB.length; i=i+2)
- {
- browsers[j] = new String(PIB[i]);
-
- if (dw.getPrimaryBrowser() == PIB[i+1])
- browsers[j] += "\tF12";
- if (navigator.platform == "MacPPC")
- {
- if (dw.getSecondaryBrowser() == PIB[i+1])
- browsers[j] += "\t \021F12";
- }
- else
- {
- if (dw.getSecondaryBrowser() == PIB[i+1])
- browsers[j] += "\t Ctrl+F12";
- }
-
- browsers[j] += ";id='"+escQuotes(PIB[i])+"'";
- j = j+1;
- }
- return browsers;
- }
-